/* eslint-disable */
// 该文件由 OneAPI 自动生成，请勿手动修改！
import {objectToFormData} from '@/utils/fileUtil';
import {apiPrefixDispose} from '@/utils/format';
import {request} from '@umijs/max';

/**
   * 上传文件
   * @param formData 文本数据
   */
 export async function upload<T = any>(
  body: API.UploadFile,
  options?: { [key: string]: any },
) {
  // console.log("上传文件",body);

  const formData  = objectToFormData(body);

  return request<API.ResultVO<API.FileIndexVO>>(apiPrefixDispose(`/files/operation/upload`), {
    method: 'POST',
    headers: {
        'Content-Type': 'multipart/form-data',
    },
    data: formData,
    ...(options || {}),
  });
}

/**
 * 通过urlSuffix删除文件
 */
export async function removeUrlSuffix<T = any>(
  urlSuffix: string,
  options?: { [key: string]: any },
) {
  return request<API.ResultVO<string>>(apiPrefixDispose(`/files/manager/urlSuffix/remove`), {
    method: 'DELETE',
    params: { 'urlSuffix':urlSuffix },
    ...(options || {}),
  });
}

